<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改劳务用工合同')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: bootstrap-fileinput-css" />
</head>
<style>
    .jltable{
        margin: auto;
    }
    .jltable th,td{
        min-height: 40px;
        min-width: 50px;
        border: 1px solid #eee;
        padding: 10px;
    }
</style>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-yght-edit" th:object="${lwpqYght}">
            <h4 class="form-header h4">合同信息</h4>
            <input name="id" th:field="*{id}" type="hidden">
            <table class="jltable">
                <tbody>
                <tr>
                    <td> <label class="control-label">合同名称</label></td>
                    <td><input th:field="*{htmc}" name="htmc" class="form-control" type="text"></td>
                    <td><label class="control-label">用工单位</label></td>
                    <td><input th:field="*{ygdw}" name="ygdw" class="form-control" type="text"></td>
                </tr>
                <tr>
                    <td> <label class="control-label">签署人</label></td>
                    <td><input th:field="*{qsr}" name="qsr" class="form-control" type="text"></td>
                    <td> <label class="control-label">员工类型</label></td>
                    <td>
                        <select name="yglx" class="form-control" th:with="type=${@dict.getType('lwpq_ygfl')}">
                            <option th:field="*{yglx}" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td> <label class="control-label is-required">签署公司</label></td>
                    <td> <input th:field="*{qsgs}" name="qsgs" class="form-control" type="text" required></td>
                    <td> <label class="control-label">身份证号</label></td>
                    <td><input th:field="*{sfzh}" name="sfzh" class="form-control" type="text"></td>
                </tr>
                <tr>
                    <td><label class="control-label">营业执照号</label></td>
                    <td><input th:field="*{yyzzh}"  name="yyzzh" class="form-control" type="text"></td>
                    <td><label class="control-label">状态</label></td>
                    <td>
                        <select name="zt" class="form-control" th:with="type=${@dict.getType('yghtzt')}">
                            <option th:field="*{zt}" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                        </select>
                    </td>
                </tr>
                <tr>
                    <td><label class="control-label">合同类型</label></td>
                    <td>
                        <select name="htlx" class="form-control" th:with="type=${@dict.getType('pqhtlx')}">
                            <option th:field="*{htlx}" th:each="dict : ${type}" th:text="${dict.dictLabel}" th:value="${dict.dictValue}"></option>
                        </select>
                    </td>
                    <td><label class=" control-label">签约状态</label></td>
                    <td> <input th:field="*{qyzt}" name="qyzt" class="form-control" type="text"></td>
                </tr>
                <tr>
                    <td><label class="control-label">合同期限</label></td>
                    <td><input th:field="*{htqx}" name="htqx" class="form-control" type="text"></td>
                    <td> <label class=" control-label">试用期</label></td>
                    <td> <input th:field="*{syq}" name="syq" class="form-control" type="text"></td>
                </tr>
                <tr>
                    <td><label class="control-label">入职日期</label></td>
                    <td>
                        <div class="input-group date">
                            <input th:value="${#dates.format(lwpqYght.rzrq, 'yyyy-MM-dd')}" name="rzrq" class="form-control" placeholder="yyyy-MM-dd" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </td>
                    <td><label class="control-label">开始日期</label></td>
                    <td>
                        <div class="input-group date">
                            <input th:value="${#dates.format(lwpqYght.ksrq, 'yyyy-MM-dd')}" name="ksrq" class="form-control" placeholder="yyyy-MM-dd" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td><label class="control-label">转正日期</label></td>
                    <td>
                        <div class="input-group date">
                            <input th:value="${#dates.format(lwpqYght.zzrq, 'yyyy-MM-dd')}" name="zzrq" class="form-control" placeholder="yyyy-MM-dd" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </td>
                    <td><label class=" control-label">截至日期</label></td>
                    <td>
                        <div class="input-group date">
                            <input th:value="${#dates.format(lwpqYght.jzrq, 'yyyy-MM-dd')}"name="jzrq" class="form-control" placeholder="yyyy-MM-dd" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td><label class="control-label">提前终止</label></td>
                    <td>
                        <div class="input-group date">
                            <input th:value="${#dates.format(lwpqYght.tqzz, 'yyyy-MM-dd')}" name="tqzz" class="form-control" placeholder="yyyy-MM-dd" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </td>
                    <td> <label class="control-label">签订时间</label></td>
                    <td>
                        <div class="input-group date">
                            <input th:value="${#dates.format(lwpqYght.qdsj, 'yyyy-MM-dd')}" name="qdsj" class="form-control" placeholder="yyyy-MM-dd" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </td>
                </tr>
                <tr>
                    <td><label class="control-label">合同内容</label></td>
                    <td colspan="3"> <textarea th:field="*{htnr}" name="htnr" class="form-control"></textarea></td>
                </tr>
                <tr>
                    <td><label class="control-label">相关文件</label></td>
                    <td colspan="3">
                        <div>
                            <input  type="hidden" name="xgwj" >
                            <div class="file-loading">
                                <input  class="form-control file-upload" id="xgwj" name="file" type="file">
                            </div>
                        </div>
                    </td>
                </tr>
                </tbody>
            </table>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: bootstrap-fileinput-js" />
    <script th:inline="javascript">
        var prefix = ctx + "lwpq/yght";
        $("#form-yght-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-yght-edit').serialize());
            }
        }

        $("input[name='rzrq']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='ksrq']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='zzrq']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='jzrq']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='tqzz']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $("input[name='qdsj']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });
        $(".file-upload").each(function (i) {
            var val = $("input[name='" + this.id + "']").val()
            $(this).fileinput({
                'uploadUrl': ctx + 'common/upload',
                initialPreviewAsData: true,
                maxFileCount: 1,
                initialPreview: [val],
                autoReplace:true
            }).on('fileuploaded', function (event, data, previewId, index) {
                $("input[name='" + event.currentTarget.id + "']").val(data.response.fileName)
            }).on('fileremoved', function (event, id, index) {
                $("input[name='" + event.currentTarget.id + "']").val('')
            })
            $(this).fileinput('_initFileActions');
        });
    </script>
</body>
</html>